package com.syp.auth.dao.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.syp.auth.dao.po.UserEntity;

@Repository
public interface UserRepository extends JpaRepository<UserEntity, Long>, JpaSpecificationExecutor<UserEntity> {

	@Query("DELETE UserEntity WHERE id in(:ids)")
	@Modifying
	public int deleteBatch(@Param("ids") List<Long> ids);

	@Query("FROM UserEntity WHERE userCode=:userCode")
	public UserEntity getByUserCode(@Param("userCode") String userCode);

	@Query("FROM UserEntity WHERE userCode=:userCode AND password=:password")
	public UserEntity signin(@Param("userCode") String userCode, @Param("password") String password);
}